import turtle
import math

# 创建画布和画笔
canvas = turtle.Screen()
pen = turtle.Turtle()

# 设置画笔的颜色和宽度
pen.color('black')
pen.pensize(1)

# 循环绘制三个正方形
for i in range(3):
    # 计算正方形的边长
    length = 50 * (i + 1)
    # 将画笔移动到正方形左上角的顶点
    pen.penup()
    pen.goto(-length / 2, -length / 2)
    pen.pendown()
    # 绘制正方形
    for j in range(4):
        pen.forward(length)
        pen.left(90)
    # 将画笔移动到下一个起始点
    pen.penup()
    pen.goto(-length / 2 + length / 4, length / 2 - length / 4)
    pen.pendown()

#绘制对称图形
for i in range(3):
    # 计算正方形的边长
    length = 50 * (i + 1)
    # 将画笔移动到正方形左上角的顶点
    pen.penup()
    pen.goto(-length / 2+150, -length / 2)
    pen.pendown()
    # 绘制正方形
    for j in range(4):
        pen.forward(length)
        pen.left(90)
        
#绘制交叉线
pen.penup()
pen.goto(-150/2, 0)
pen.pendown()
pen.setheading(0)
pen.forward(50)

pen.penup()
pen.goto(150/2, 0)
pen.pendown()
pen.setheading(-180)
pen.forward(50)

pen.penup()
pen.goto(0,-150/2)
pen.pendown()
pen.setheading(90)
pen.forward(50)

pen.penup()
pen.goto(0,150/2)
pen.pendown()
pen.setheading(-90)
pen.forward(50)

a1 = math.sqrt(50*50+50*50)

pen.penup()
pen.goto(-75,150/2)
pen.pendown()
pen.setheading(-45)
pen.forward(a1)

pen.penup()
pen.goto(75,150/2)
pen.pendown()
pen.setheading(-135)
pen.forward(a1)

pen.penup()
pen.goto(-75,-150/2)
pen.pendown()
pen.setheading(45)
pen.forward(a1)

pen.penup()
pen.goto(75,-150/2)
pen.pendown()
pen.setheading(135)
pen.forward(a1)


#绘制交叉线
pen.penup()
pen.goto(-150/2+150, 0)
pen.pendown()
pen.setheading(0)
pen.forward(50)

pen.penup()
pen.goto(150/2+150, 0)
pen.pendown()
pen.setheading(-180)
pen.forward(50)

pen.penup()
pen.goto(0+150,-150/2)
pen.pendown()
pen.setheading(90)
pen.forward(50)

pen.penup()
pen.goto(0+150,150/2)
pen.pendown()
pen.setheading(-90)
pen.forward(50)

a1 = math.sqrt(50*50+50*50)

pen.penup()
pen.goto(-75+150,150/2)
pen.pendown()
pen.setheading(-45)
pen.forward(a1)

pen.penup()
pen.goto(75+150,150/2)
pen.pendown()
pen.setheading(-135)
pen.forward(a1)

pen.penup()
pen.goto(-75+150,-150/2)
pen.pendown()
pen.setheading(45)
pen.forward(a1)

pen.penup()
pen.goto(75+150,-150/2)
pen.pendown()
pen.setheading(135)
pen.forward(a1)

pen.color('red')
pen.pensize(3)

pen.penup()
pen.goto(-50,-50)
pen.pendown()
pen.setheading(0)
    # 绘制正方形
for j in range(4):
    pen.forward(100)
    pen.left(90)

pen.penup()
pen.goto(100,-50)
pen.pendown()
pen.setheading(0)
    # 绘制正方形
for j in range(4):
    pen.forward(100)
    pen.left(90)

# 关闭画布
canvas.exitonclick()
